﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category0
{
  public class MT048 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagSequenceDefinition U0002;

    [Description("")]
    public MT048.Block4Class Block4
    {
      get
      {
        MT048.Block4Class block4Class = new MT048.Block4Class((SwiftElement) this, 0, false);
        if (this.ListTags((SwiftElement) block4Class).Count > 0)
          return block4Class;
        else
          return (MT048.Block4Class) null;
      }
    }

    public MT048()
      : base(true)
    {
    }

    public MT048(SwiftMessage message)
      : base(message)
    {
    }

    public MT048.Block4Class AddBlock4()
    {
      return this.Block4 ?? new MT048.Block4Class((SwiftElement) this, 0, true);
    }

    public void RemoveBlock4(MT048.Block4Class sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT048.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT048.MessageDefinition = new SwiftMessageDefinition("MT048", "Undelivered Report Rules Request");
      MT048.U0002 = new SwiftTagSequenceDefinition("Block4", "");
      MT048.U0002.Mandatory = false;
      MT048.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT048.U0002);
    }

    public class Block4Class : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT048.U0002;
        }
      }

      internal Block4Class(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }
    }
  }
}
